import Cookies from 'js-cookie'

// const TokenKey = 'Admin-Token'
const TokenKey = 'token'
const ShopKey = 'ShopListKey'
const ExpiresInKey = 'Admin-Expires-In'
const CnCodeKey = 'cnCode'
export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}

export function getExpiresIn() {
  return Cookies.get(ExpiresInKey) || -1
}

export function setExpiresIn(time) {
  return Cookies.set(ExpiresInKey, time)
}

export function removeExpiresIn() {
  return Cookies.remove(ExpiresInKey)
}


export function setShopList(shopList) {
  return Cookies.set(ShopKey, shopList)
}

export function getShopList() {
  return Cookies.get(ShopKey)
}

export function setCnCode(cnCode) {
  return Cookies.set(CnCodeKey, cnCode, {expires: 1})
}

export function getCnCode() {
  return Cookies.get(CnCodeKey)
}
